package com.example.partner.adapter.find;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.viewpager2.adapter.FragmentStateAdapter;

import com.example.partner.fragment.find.FellowFragment;
import com.example.partner.fragment.find.MyPublishFragment;
import com.example.partner.fragment.find.RecommendFragment;

public class FindPagerAdapter extends FragmentStateAdapter {

    public FindPagerAdapter(@NonNull Fragment fragment) {
        super(fragment);
    }

    @NonNull
    @Override
    public Fragment createFragment(int position) {
        // 返回对应位置的Fragment
        switch (position) {
            case 0:
                return new RecommendFragment();
            case 1:
                return new FellowFragment();
            case 2:
                return new MyPublishFragment();
            default:
                return new RecommendFragment();
        }
    }

    @Override
    public int getItemCount() {
        // 返回Fragment的数量
        return 3;
    }
}
